<template>
  <div
    class="flex flex-row justify-end py-[10px] px-[20px] fixed bottom-0 w-1/1 z-2 w-[768px] bg-[#fff] left-[50%] transform translate-x-[-50%]"
    style="box-shadow: 5px 0 10px rgb(0 0 0 / 10%)"
  >
    <div class="absolute left-[20px] transform translate-y-[-50%] top-[50%] text-[#8D8D8D] text-[14px]">
      正文字数<span class="ml-[10px]">{{ pureTextLength }}</span>
    </div>
    <el-button type="success" @click="submit">保存并发表</el-button>
  </div>
</template>

<script setup lang="ts">
import { computed } from "vue";

interface Result {
  cont?: string;
}

const pureTextLength = computed(() => {
  return props.cont.replace(/<[^>]+>/g, "").length;
});

const props = withDefaults(defineProps<Result>(), {
  cont: ""
});

// 提交
const emits = defineEmits(["publish"]);
const submit = () => {
  emits("publish");
};
</script>

<style></style>
